/*
接收用户输入的命令行参数

*/
use clap::{Parser, Subcommand};
mod cli_legality_check;
#[derive(Parser, Debug)]
#[command(author, version, about)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand, Debug)]
pub enum ConfigCommands {
    ///设置输出目录
    Output {
        /// 指定原始数据存放的一级目录，我会在一级目录创建一个android_collection目录
        #[arg(short, long, default_value = "/sdcard")]
        output: String,

    },
    /// 设置跟ftrace相关的初始化
    Ftrace{
        /// 是否输出调试信息
        #[arg(short='v', long, default_value_t = false)]
        debug: bool,

        ///添加一个ftrace event
        #[arg(short, long)]
        add_event: Vec<String>,

        ///删除一个ftrace event
        #[arg(short, long)]
        delete_event: Vec<String>,
    },
    Simpleperf {
        /// 是否输出调试信息
        #[arg(short, long, default_value_t = false)]
        debug: bool,
    }
}

#[derive(Subcommand, Debug)]
pub enum Commands {
    /// 初始化配置文件
    Init {
        /// 想要配置的选项
        #[command(subcommand)]
        config: ConfigCommands
    },

    /// 获取当前配置信息
    Get {
        /// 是否输出调试信息
        #[arg(short, long, default_value_t = false)]
        debug: bool,
    },

    /// 开始获取数据
    Run {
        /// 是否输出调试信息
        #[arg(short, long, default_value_t = false)]
        debug: bool,
    },
}

pub fn get_args() -> Cli {

    Cli::parse()
}